﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace com.sharepointutils.application2007
{
    public class SP07List : SP07Base
    {
        public String Title { get; set; }
        public Guid ListID { get; set; }

        public SP07ListItemCollection GetListItems(SP07Query query)
        {
            String listNameXML = "<listName>"+ Title + "</listName>";
            String queryXML = query.ToXML();
            String content = String.Format("<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Body><GetListItems xmlns=\"http://schemas.microsoft.com/sharepoint/soap/\">{0}{1}</GetListItems></soap:Body></soap:Envelope>", listNameXML, queryXML);
            SP07ListItemCollection collection = new SP07ListItemCollection(this);
            collection.Request = new SPWebServicesRequest(Context.URL + "/_vti_bin/Lists.asmx" ,"http://schemas.microsoft.com/sharepoint/soap/GetListItems", content);
            return collection;
        }

    }
}
